import React, {useState} from 'react';
import {ProColumns} from '@ant-design/pro-table';
import {DemandType} from './data.d';
import {modulesUrl} from "@/assets/constant/modulesUrl";
import TableList from "@/assets/components/tableList";
import {hooksSet} from "@/assets/utils/utils";

const UserList: React.FC<{}> = () => {
  const [columns, setColumns] = useState<ProColumns<DemandType>[]>([
    {
      title: '名称',
      dataIndex: 'name',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '名称为必填项',
          },
        ],
      },
    },
    {
      title: '预计工时（小时）',
      hideInSearch:true,
      // @ts-ignore
      valueType: 'number',
      dataIndex: 'estimateWorkingHours',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '预计工时为必填项',
          },
        ],
      },
    },
    {
      title: '描述',
      hideInSearch:true,
      dataIndex: 'description',
      valueType: 'textarea',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '描述为必填项',
          },
        ],
      },
    },
  ]);

  return (
    <TableList changeColumns={(columns: any) => hooksSet(setColumns, columns)} columns={columns} moduleUrl={modulesUrl.demandDemandType} title={"需求类型管理"} />
  );
};

export default UserList;
